package cn.myschool.test.day4;

import cn.myschool.dao.StudentDao;
import cn.myschool.entity.Student;
import cn.myschool.util.MybatisUtil;
import cn.myschool.util.StrUtil;
import org.apache.ibatis.session.SqlSession;

import java.util.Date;
import java.util.List;

/**
 * @author oldliu
 * @since 1.0
 */
public class Tiaojian1 {
    public static void main(String[] args) {
        SqlSession s = MybatisUtil.get();
        StudentDao mapper = s.getMapper(StudentDao.class);
//        int total = mapper.findTotal();
//        System.out.println(total);
        List<Student> datas= mapper.search("", null, "王", StrUtil.toDate("2019-1-4"),new Date(), 1, 10);
        datas.forEach(x->{
            System.out.println(x.getStuno()+","+x.getSname());
        });
        int total=mapper.searchTotal("", null, "王", StrUtil.toDate("2019-1-4"),new Date());
        System.out.println("总共有"+total+"条");
        MybatisUtil.close(s);
    }
}
